package com.example.lhsama.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * @Date: 2021年09月19日 14:33
 * @Author: LHSAMA
 */
@Data
public class Orders {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String orderNum;
    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date orderTime;
    private Integer orderStatus;
    @TableField(exist = false)
    private String orderStatusStr;//1.开启  0.关闭
    private Integer payType;
    @TableField(exist = false)
    private String payTypeStr;//0.微信  1.支付宝  2.银行卡
    private String orderDesc;
    private String memberId;
    private Integer deleted;//0.存在 1.删除
    @TableField(exist = false)
    private Member member;

    @TableField(exist = false)
    private List<Product> products;

    public String getPayTypeStr() {
        if (payType==0){
            return "微信";
        }else if(payType == 1){
            return "支付宝";
        }else if (payType == 2){
            return "银行卡";
        }

        return null;
    }

    public String getOrderStatusStr() {
        return orderStatus==0?"关闭":"开启";
    }
}
